/*     */ package dm.jdbc.innerData;
/*     */ 
/*     */ import dm.jdbc.dataConvertion.Convertion;
/*     */ 
/*     */ 
/*     */ public class DmdbExecOpt
/*     */ {
/*   8 */   private StringBuffer m_sqlBuf = null;
/*   9 */   private byte[] m_types = null;
/*  10 */   private int m_typesLen = 0;
/*  11 */   private byte[] m_values = null;
/*  12 */   private int m_valuesLen = 0;
/*  13 */   private boolean m_toPrepare = false;
/*  14 */   private int m_paramCount = 0;
/*  15 */   private boolean m_hasError = false;
/*  16 */   private String m_orgSql = "";
/*     */   
/*  18 */   private final int type_fix_len = 13;
/*     */   
/*     */   public DmdbExecOpt()
/*     */   {
/*  22 */     this.m_sqlBuf = new StringBuffer();
/*  23 */     this.m_types = new byte[0];
/*  24 */     this.m_values = new byte[0];
/*     */   }
/*     */   
/*     */   public void addSqlWord(String sqlword) {
/*  28 */     this.m_sqlBuf.append(sqlword);
/*     */   }
/*     */   
/*     */   public String getSqlStr() {
/*  32 */     return this.m_sqlBuf.toString();
/*     */   }
/*     */   
/*     */   public void addParam(byte[] value, int type, int typelen) {
/*  36 */     addValue(value);
/*  37 */     addType(type, typelen);
/*     */     
/*  39 */     this.m_paramCount += 1;
/*     */   }
/*     */   
/*     */   private void addType(int type, int typelen) {
/*  43 */     if (this.m_typesLen + 13 > this.m_types.length) {
/*  44 */       byte[] temp = new byte[this.m_types.length + 
/*  45 */         8192];
/*  46 */       System.arraycopy(this.m_types, 0, temp, 0, this.m_typesLen);
/*     */       
/*  48 */       this.m_types = new byte[temp.length];
/*  49 */       System.arraycopy(temp, 0, this.m_types, 0, this.m_typesLen);
/*     */     }
/*     */     
/*  52 */     System.arraycopy(Convertion.byteToByteArray((byte)0), 0, this.m_types, 
/*  53 */       this.m_typesLen, 1);
/*  54 */     this.m_typesLen += 1;
/*  55 */     System.arraycopy(Convertion.IntToByteArray(type), 0, this.m_types, 
/*  56 */       this.m_typesLen, 4);
/*  57 */     this.m_typesLen += 4;
/*  58 */     System.arraycopy(Convertion.IntToByteArray(typelen), 0, this.m_types, 
/*  59 */       this.m_typesLen, 4);
/*  60 */     this.m_typesLen += 4;
/*  61 */     System.arraycopy(Convertion.IntToByteArray(0), 0, this.m_types, this.m_typesLen, 
/*  62 */       4);
/*  63 */     this.m_typesLen += 4;
/*     */   }
/*     */   
/*     */   public byte[] getTypes() {
/*  67 */     return this.m_types;
/*     */   }
/*     */   
/*     */   public int getTypesLen() {
/*  71 */     return this.m_typesLen;
/*     */   }
/*     */   
/*     */   private void addValue(byte[] value) {
/*  75 */     int len = value.length;
/*  76 */     if (this.m_valuesLen + len + 2 > this.m_values.length) {
/*  77 */       byte[] temp = new byte[this.m_values.length + 
/*  78 */         8192];
/*  79 */       System.arraycopy(this.m_values, 0, temp, 0, this.m_valuesLen);
/*     */       
/*  81 */       this.m_values = new byte[temp.length];
/*  82 */       System.arraycopy(temp, 0, this.m_values, 0, this.m_valuesLen);
/*     */     }
/*     */     
/*  85 */     System.arraycopy(Convertion.shortToByteArray(len), 0, this.m_values, 
/*  86 */       this.m_valuesLen, 2);
/*  87 */     this.m_valuesLen += 2;
/*  88 */     System.arraycopy(value, 0, this.m_values, this.m_valuesLen, len);
/*  89 */     this.m_valuesLen += len;
/*     */   }
/*     */   
/*     */   public byte[] getValues() {
/*  93 */     return this.m_values;
/*     */   }
/*     */   
/*     */   public int getValuesLen() {
/*  97 */     return this.m_valuesLen;
/*     */   }
/*     */   
/*     */   public boolean isToPrepare() {
/* 101 */     return this.m_toPrepare;
/*     */   }
/*     */   
/*     */   public void setToPrepare(boolean prepare) {
/* 105 */     this.m_toPrepare = prepare;
/*     */   }
/*     */   
/*     */   public int getParamCount() {
/* 109 */     return this.m_paramCount;
/*     */   }
/*     */   
/*     */   public void setHasErrorOrProcessed(boolean err) {
/* 113 */     this.m_hasError = err;
/*     */   }
/*     */   
/*     */   public boolean hasErrorOrProcessed() {
/* 117 */     return this.m_hasError;
/*     */   }
/*     */   
/*     */   public boolean useOrgSql()
/*     */   {
/* 122 */     return (this.m_hasError) || (this.m_toPrepare) || (this.m_paramCount > 600);
/*     */   }
/*     */   
/*     */   public void setOrgSql(String orgSql) {
/* 126 */     this.m_orgSql = orgSql;
/*     */   }
/*     */   
/*     */   public String getOrgSql() {
/* 130 */     return this.m_orgSql;
/*     */   }
/*     */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\innerData\DmdbExecOpt.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */